<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core" xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui"
	xmlns:jc="http://jcertif.com/facelets">

<ui:composition template="/templates/template.xhtml">
	<ui:define name="content">
		<jc:pageBanner title="#{msg['suggest.banner.title']}" />
		<c:choose>
			<c:when test="#{sessionScope.connectedUser != null}">
				<br />
				<div class="form-intro">#{msg['suggest.intro']}</div>
				<br />
				<h:form id="suggest">
					<h:panelGrid columns="2" columnClasses="label, value" styleClass="grid">
						<h:outputText value="#{msg['suggest.title']} *" />
						<p:inputText id="title" value="#{suggestBean.suggest.title}" required="true"
							requiredMessage="#{msg['suggest.title.reqmsg']}" size="57" />

						<h:outputText value="#{msg['suggest.desc']} *" />
						<p:inputTextarea id="desc" value="#{suggestBean.suggest.summary}" required="true"
							requiredMessage="#{msg['suggest.desc.reqmsg']}" rows="5" cols="60" maxlength="255"  />

						<h:outputText value="#{msg['suggest.subject']} *" />
						<p:selectManyCheckbox value="#{suggestBean.selectedSujets}" layout="pageDirection" required="true" requiredMessage="#{msg['suggest.subject.reqmsg']}">
							<f:selectItems value="#{suggestBean.sujets}" />
						</p:selectManyCheckbox>

						<h:outputText value="#{msg['suggest.summary']} *" />
						<p:inputTextarea id="summary" value="#{suggestBean.suggest.description}" required="true"
							requiredMessage="#{msg['suggest.summary.reqmsg']}" rows="10" cols="60" maxlength="1000"/>
						
						<h:outputText value="#{msg['suggest.bio']} *" />
						<p:inputTextarea id="bio" value="#{suggestBean.bio}" required="true"
							requiredMessage="#{msg['suggest.bio.reqmsg']}" rows="5" cols="60" />

						<h:outputText value="#{msg['suggest.needs']}" />
						<p:inputText value="#{suggestBean.suggest.needs}" size="57" />

						<h:outputText value="#{msg['suggest.keywords']}" />
						<p:inputText value="#{suggestBean.suggest.keyword}" size="57" />

						<p:commandButton value="#{msg['suggest.save']}" update="suggest"
							actionListener="#{suggestBean.save}" />
						<p:messages />

					</h:panelGrid>
				</h:form>
			</c:when>
			<c:otherwise>
				<f:view>
					<f:event listener="#{suggestBean.redirectToLogin}" type="preRenderView"></f:event>
				</f:view>
			</c:otherwise>

		</c:choose>


	</ui:define>
</ui:composition>
</html>